package com.intelligencesoft.pss.entity.publish;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.intelligencesoft.pss.entity.BasePojo;

@Entity
@Table(name="T_PUBLISH_IMAGE")
public class PublishImage extends BasePojo{

	private static final long serialVersionUID = 1751139295552828555L;
	
	private String imagePath;
	
	private PublishInfo publishInfo;
	
	@Id
	@Column(name = "C_ID", nullable = false, length = 32)
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	public String getId() {
		return super.getId();
	}
	
	public void setId(String id) {
		super.setId(id);
	}
	
	@Column(name="C_CREATE_DATE")
	@Temporal(value=TemporalType.TIMESTAMP)
	public Date getCreateDate() {
		return super.getCreateDate();
	}
	public void setCreateDate(Date createDate) {
		super.setCreateDate(createDate);
	}
	
	@Column(name="C_DESCRIPTION")
	public String getDescription() {
		return super.getDescription();
	}

	public void setDescription(String description) {
		super.setDescription(description);
	}
	
	@Column(name="C_IMAGE_PATH")
	public String getImagePath() {
		return imagePath;
	}

	public void setImagePath(String imagePath) {
		this.imagePath = imagePath;
	}

	@ManyToOne(cascade = CascadeType.ALL, optional = false)
	@JoinColumn(name="C_PUBLISH_INFO_ID", referencedColumnName="C_ID")
	@NotFound(action=NotFoundAction.IGNORE)
	public PublishInfo getPublishInfo() {
		return publishInfo;
	}

	public void setPublishInfo(PublishInfo publishInfo) {
		this.publishInfo = publishInfo;
	}
}
